-
Notifications
You must be signed in to change notification settings - Fork 121
refactor: update SettingsPage to handle async params #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: update SettingsPage to handle async params #257
Conversation
|
@sbansal1999 is attempting to deploy a commit to the Databuddy OSS Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughTwo files updated: a page component transitions to async and updates its params prop type to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (13)**/*.{ts,tsx,js,jsx,vue}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{html,htm,tsx,jsx,vue}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{css,scss,sass,less,html,htm,tsx,jsx,vue}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{ts,tsx,js,jsx,css,scss,sass,less}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{tsx,jsx,vue}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{tsx,jsx}📄 CodeRabbit inference engine (.cursor/rules/guidelines.mdc)
Files:
**/*.{ts,tsx,jsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
!(**/pages/_document.{ts,tsx,jsx})**/*.{ts,tsx,jsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{ts,tsx,html,css}📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/01-MUST-DO.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/01-MUST-DO.mdc)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-12-02T22:55:00.415ZApplied to files:
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR updates the SettingsPage to handle async params (aligning with Next.js 15+ conventions) and changes the category detection logic from Changes:
Issues Found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant NextJS as Next.js Router
participant SettingsPage
participant NavConfig as Navigation Config
Client->>NextJS: Navigate to /websites/[id]/settings
NextJS->>SettingsPage: Render with params Promise
SettingsPage->>SettingsPage: await params
SettingsPage->>SettingsPage: Extract id
SettingsPage->>NextJS: redirect(/websites/{id}/settings/general)
NextJS->>NavConfig: getDefaultCategory(/websites/{id}/settings/general)
Note over NavConfig: BUG: includes() matches /settings<br/>Should only match /settings routes
NavConfig->>NavConfig: Incorrect category selection
NavConfig-->>Client: Wrong sidebar category displayed
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
apps/dashboard/components/layout/navigation/navigation-config.tsx, line 416 (link)logic: Changing from
startsWithtoincludesintroduces a bug. Withincludes, the path/websites/123/settings/generalnow incorrectly matches the/settingspattern, when it should only match when explicitly navigating to/settings/*routes. This breaks category detection for website settings pages. Consider adding a path boundary check:Or use a regex to ensure word boundary matching.
2 files reviewed, 1 comment
Description
Since the params are sent as a promise, they have to be awaited before they are read on a page. This PR awaits that promise and also updates the navigation category function to use
includesrather thanstartsWithto detect the category.Checklist
Summary by CodeRabbit
Refactor
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.